package com.zjty.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zjty.mapper.UserInfoMapper;
import com.zjty.pojo.Page;
import com.zjty.pojo.UserInfo;
import com.zjty.util.PageUtil;

@Service
public class UserInfoServiceImpl implements UserInfoService {
	@Resource
	private UserInfoMapper userInfoMapper;

	@Override
	public Page<UserInfo> selectUser(int pageNum, String userName, String userPhone, String userCreatedate) {
		List<UserInfo> list = userInfoMapper.selectUser(Page.pageSize, PageUtil.pageStart(pageNum), userName, userPhone,
				userCreatedate);
		int count = userInfoMapper.count(userName, userPhone, userCreatedate);
		int totalPage = PageUtil.totalPage(count);
		return new Page<UserInfo>(totalPage, pageNum, list);
	}

	@Override
	public UserInfo checkUserByPhone(String userPhone) {
		return userInfoMapper.checkUserByPhone(userPhone);
	}
}
